]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-generic-container: Exclude skip_paint actors from the paint volume
authorAdel Gadllah <adel.gadllah@gmail.com>
Fri, 1 Mar 2013 17:43:34 +0000 (18:43 +0100)
committerAdel Gadllah <adel.gadllah@gmail.com>
Fri, 1 Mar 2013 18:13:10 +0000 (19:13 +0100)
We are not painting them so there is no reason to redraw a bigger
area because of them.

src/shell-generic-container.c

index 48b8b3c2d6b22aa83ad74166023084632af72dac..7bca9c776a14cc6d03a053cd1b471f3a2021357f 100644 (file)
@@ -236,6 +236,60 @@ shell_generic_container_set_skip_paint (ShellGenericContainer  *self,
   clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
 }
 
+static gboolean
+shell_generic_container_get_paint_volume (ClutterActor *self,
+                                          ClutterPaintVolume *volume)
+{
+  ClutterActorBox paint_box, alloc_box;
+  StThemeNode *theme_node;
+  ClutterVertex origin;
+
+  /* Setting the paint volume does not make sense when we don't have any allocation */
+  if (!clutter_actor_has_allocation (self))
+    return FALSE;
+
+  theme_node = st_widget_get_theme_node (ST_WIDGET (self));
+  clutter_actor_get_allocation_box (self, &alloc_box);
+
+  st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box);
+
+  origin.x = paint_box.x1 - alloc_box.x1;
+  origin.y = paint_box.y1 - alloc_box.y1;
+  origin.z = 0.0f;
+
+  clutter_paint_volume_set_origin (volume, &origin);
+  clutter_paint_volume_set_width (volume, paint_box.x2 - paint_box.x1);
+  clutter_paint_volume_set_height (volume, paint_box.y2 - paint_box.y1);
+
+  if (!clutter_actor_get_clip_to_allocation (self))
+    {
+      ClutterActor *child;
+      /* Based on ClutterGroup/ClutterBox; include the children's
+       * paint volumes, since they may paint outside our allocation.
+       */
+      for (child = clutter_actor_get_first_child (self);
+           child != NULL;
+           child = clutter_actor_get_next_sibling (child))
+        {
+          const ClutterPaintVolume *child_volume;
+
+          if (!CLUTTER_ACTOR_IS_VISIBLE (child))
+            continue;
+
+          if (shell_generic_container_get_skip_paint (SHELL_GENERIC_CONTAINER  (self), child))
+            continue;
+
+          child_volume = clutter_actor_get_transformed_paint_volume (child, self);
+          if (!child_volume)
+            return FALSE;
+
+          clutter_paint_volume_union (volume, child_volume);
+        }
+    }
+
+  return TRUE;
+}
+
 static void
 shell_generic_container_finalize (GObject *object)
 {
@@ -260,6 +314,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
   actor_class->allocate = shell_generic_container_allocate;
   actor_class->paint = shell_generic_container_paint;
   actor_class->pick = shell_generic_container_pick;
+  actor_class->get_paint_volume = shell_generic_container_get_paint_volume;
 
   widget_class->get_focus_chain = shell_generic_container_get_focus_chain;